﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Texfina.Entity.Co;
using Texfina.BOQry.Co;
using System.Collections;
using Texfina.Core.Common;

namespace CO
{
    public partial class wfProveedorBnd : System.Web.UI.Page
    {
        ETerceros prov = new ETerceros();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ListarProveedor();
            }
        }

        private void ListarProveedor()
        {
            try
            {
                prov.Id_clipro = txtCodigo.Text;
                prov.Ds_raznombre = txtRazonSoc.Text;
                prov.Nu_dociden = txtDocIdent.Text;
                prov.St_vtipcli = dpCliente.SelectedValue;
                prov.St_vtippro = dpProveedor.SelectedValue;
                prov.Nu_ruc = txtRuc.Text;
                prov.Id_empresa = Session[ConstSessionVar.EMPRESA].ToString();
                gvListar.DataSource = BProveedor.Proveedor_qry03(prov);
                gvListar.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }

        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            ListarProveedor();
        }

        protected void gvListar_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
                case "Detalle":
                    string Id_prov = (string)e.CommandArgument;
                    Hashtable htDatos = new Hashtable();
                    htDatos.Add("id_clipro", Id_prov);
                    htDatos.Add("in_ventana", "1");
                    Session["htaProvCli"] = htDatos;
                    Response.Redirect("WfProveedorX.aspx");
                    break;
               
            }
        }

        protected void mnuToolbar_MenuItemClick(object sender, MenuEventArgs e)
        {
            if (e.Item == null)
                return;

            switch (e.Item.Value)
            {

                case Constants2.ConstMenuToolbarValue.BUTTON_NEW:
                     Session["htaProvCli"] = null;
                       Hashtable HtaDatos = new Hashtable();
                       Session["htaProvCliNuevo"] = HtaDatos;
                       Response.Redirect("WfProveedorX.aspx");
                break;
            }
        }

   

    }

}